import HttpRequest from '@/libs/axios'
import config from '@/config'

const baseUrl = config.baseUrl.VUE_ORDER_URL + '/process-web'

// 列表数据
export const getModel = () => {
  return new HttpRequest(baseUrl).request({
    url: '/model',
    method: 'get'
  })
}

// 编辑
// export const editor = (id) => {
//     return axios.request({
//         url: `editor?modelId=${id}`,
//         method: 'get',
//     })
// }

// 发布
export const publish = (id) => {
  return new HttpRequest(baseUrl).request({
    url: `/publish/${id}`,
    method: 'get'
  })
}

// 撤销
export const revokePublish = (id) => {
  return new HttpRequest(baseUrl).request({
    url: `/revokePublish/${id}`,
    method: 'get'
  })
}

// 删除
export const myDelete = (id) => {
  return new HttpRequest(baseUrl).request({
    url: `/delete/${id}`,
    method: 'get'
  })
}

// 保存
export const mySave = ({ name, key }) => {
  return new HttpRequest(baseUrl).request({
    url: '/create',
    method: 'get',
    params: { name, key }
  })
}

//  发布流程列表
export const getProcessDefinitionList = ({ pageNum, pageSize }) => {
  return new HttpRequest(baseUrl).request({
    url: '/process/getProcessDefinitionList',
    method: 'get',
    params: { pageNum, pageSize }
  })
}
